Skip to content

Conversation

@joshtrichards
Copy link
Member

Summary

Improve the output when headers are missing/incorrect to make troubleshooting easier.

Minor code reformatting for readability.

New class and main function docblocks.

TODO

  • ...

Checklist

Improve the output when headers are missing/incorrect to make troubleshooting easier.

Minor code reformatting for readability.

New class and main function docblocks.

Signed-off-by: Josh <[email protected]>
@joshtrichards joshtrichards added this to the Nextcloud 33 milestone Oct 8, 2025
@joshtrichards joshtrichards requested a review from a team as a code owner October 8, 2025 23:32
@joshtrichards joshtrichards added enhancement 3. to review Waiting for reviews labels Oct 8, 2025
@joshtrichards joshtrichards requested review from ArtificialOwl and salmart-dev and removed request for a team October 8, 2025 23:32
* on the Nextcloud instance. The check issues warnings or informational messages if recommended
* security headers are missing, malformed, or set to unsafe values.
*
* This class is used by the Nextcloud setup process to ensure that the web server delivers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* This class is used by the Nextcloud setup process to ensure that the web server delivers
* This class is used to ensure that the web server delivers

It’s not part of setup (as in installation), it’s in the admin overview.

Comment on lines +22 to +23
* Class SecurityHeaders
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Class SecurityHeaders
*

I would strip these lines as they bring no information.

Comment on lines +53 to +54
* Executes the security header setup check.
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Executes the security header setup check.
*

Comment on lines +63 to +64
*
* @return SetupResult Result of the security headers setup check.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
*
* @return SetupResult Result of the security headers setup check.

Comment on lines +93 to +95
'- The `%1$s` HTTP header is not set to `%2$s`. Some features '
. 'might not work correctly, as it is recommended to adjust this '
. 'setting accordingly.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not a big fan of the string split, it breaks searching for the error string in the code. What’s the added value?

Comment on lines +161 to +164
. 'If you believe this is incorrect, review your `overwrite.cli.url` and `trusted_domains` settings. '
. 'These settings may include URLs that do not use HTTPS or bypass your reverse proxy, '
. 'which can affect header checks. '
. 'Additionally, ensure your DNS records and server configuration are consistent with your HTTPS setup.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should definitely not include unstranslated text in setupchecks results.
I’m also unsure about this added warning text, ideally we should improve the checks to make them less error-prone instead, and for special case document that in the linked documentation.
Maybe we should show a general setting on the overview page on which URL is used by the server for loopback checks, and make it configurable for special cases. Not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: False warning about missing Strict-Transport-Security header despite correct configuration behind reverse proxy

2 participants